<template>
  <footer class="footer">
    <span class="todo-count">剩余<strong>{{sum}}</strong></span>
    <ul class="filters">
      <li>
        <a @click="$emit('toggle', 'all')" :class="{selected: status==='all'}" href="javascript:;" >全部</a>
      </li>
      <li>
        <a @click="$emit('toggle', 'no')" :class="{selected: status==='no'}" href="javascript:;">未完成</a>
      </li>
      <li>
        <a @click="$emit('toggle', 'yes')" :class="{selected: status==='yes'}" href="javascript:;" >已完成</a>
      </li>
    </ul>
    <button class="clear-completed" @click="clearFn">清除已完成</button>
  </footer>
</template>
<script>
export default {
  props: ['arr', 'status'],
  computed: {
    sum () {
      return this.arr.length
    }
  },
  methods: {
    clearFn () {
      const doneArr = this.arr.filter(item => item.isDone === false)
      this.$emit('cleardone', doneArr)
    }
  }
}
</script>
